<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>
    <transition name="slide" appear>
      <h1 class="w" v-show="isShow">你好啊</h1>
    </transition>
  </div>
</template>

<script>
export default {
  name: "TestView",
  data() {
    return {
      isShow: true,
    };
  },
};
</script>

<style scoped>
.w {
  background-color: red;
}
.slide-enter-active {
  animation: slideIn 0.5s linear;
}
.slide-leave-active {
  animation: slideIn 0.5s linear reverse;
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(0);
  }
}
</style>
